Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

synckit

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

synckit

Perform async work synchronously in Node.js using `worker_threads` with first-class TypeScript support.

  • 0.8.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.6M
decreased by-20%
Maintainers
2
Weekly downloads
 
Created

What is synckit?

The synckit npm package allows for executing asynchronous tasks synchronously using worker threads or child processes. It is designed to offload heavy computation or I/O-bound tasks without blocking the main thread, thus enabling a synchronous-like coding style while maintaining non-blocking behavior.

What are synckit's main functionalities?

Running asynchronous tasks synchronously

This feature allows you to run an asynchronous task inside a worker thread and wait for the result synchronously. The 'worker.js' file should export an async function that will be executed with the provided arguments.

const { runAsWorkerThread } = require('synckit');
const result = runAsWorkerThread('./worker.js', ...args);

Creating a synchronous API from asynchronous functions

With this feature, you can create a synchronous version of an asynchronous function. The 'async-fn.js' file should export an async function that will be executed with the provided arguments, and the result will be returned synchronously.

const { createSyncFn } = require('synckit');
const syncFn = createSyncFn('./async-fn.js');
const result = syncFn(...args);

Other packages similar to synckit

Keywords

FAQs

Package last updated on 26 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc